<?php

namespace App\Transformers\Student;

use League\Fractal\TransformerAbstract;
use App\Models\Student\Student;

class StudentTransformer extends TransformerAbstract{
    public function transform(Student $model)
    {
        return [
            'id'         => (int) $model->id,
            'name'=>$model->name,
            'clbum_name'=>$model->clbum_name,
            'sex'=>$model->sex,
            'nation'=>$model->nation,
            'old_name'=>$model->old_name,
            'born_date'=>$model->born_date,
            'census_no'=>$model->census_no,
            'clbum_id'=>$model->clbum_id,
            'id_card'=>$model->id_card,
            'hometown'=>$model->hometown,
            'citizenship'=>$model->citizenship,
            'is_macao_or_taiwan'=>$model->is_macao_or_taiwan,
            'is_only_child'=>$model->is_only_child,
            'is_lodge'=>$model->is_lodge,
            'is_learn_preschool'=>$model->is_learn_preschool,
            'is_leftover_child'=>$model->is_leftover_child,
            'home_address'=>$model->home_address,
            'now_address'=>$model->now_address,
            'created_user'=>$model->created_user,
            'updated_user'=>$model->updated_user,
            'created_at' => $model->created_at->format('Y-m-d H:i:s'),
            'updated_at' => $model->updated_at->format('Y-m-d H:i:s')
        ];
    }
}
